package base.exception;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Service;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.ModelAndView;

@Service
public class SpringExceptionHandler implements HandlerExceptionResolver {

	public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
		System.out.println("全局异常处理");
//		if(ex instanceof LoginMissingException){
//			LoginMissingException loginException = (LoginMissingException)ex;
//			ModelAndView mv = new ModelAndView("error");
//			try {
//				response.sendRedirect("/error.jsp");
//			} catch (IOException e) {
//				// TODO Auto-generated catch block
//				e.printStackTrace();
//			} 
//			return mv;
//		}
		return null;
	}
}
